<?php

include_once 'DBCon.php';
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Logs
 *
 * @author Kenny
 */
class Logs {

    private $con;
    private $insertsaleslog = 'INSERT INTO saleslog VALUES(NULL, ?, NOW(), ?, ?);';
    private $insertrefundlog = 'INSERT INTO refundlog VALUES(NULL, ?,?,NOW());';

    function __construct() {
        $this->con = DBCon::connectDB();
    }

    public function insertSalesLog($amount, $madeby, $type) {
        $pstmtinsert = $this->con->prepare($this->insertsaleslog);
        $pstmtinsert->bind_param('dis', $amount, $madeby, $type);
        $pstmtinsert->execute();
        if ($pstmtinsert->affected_rows > 0) {
            return true;
        }
        return FALSE;
    }

    public function insertRefundLog($referenceno, $amount) {
        $pstmtinsert = $this->con->prepare($this->insertrefundlog);
        $pstmtinsert->bind_param('id', $referenceno, $amount);
        $pstmtinsert->execute();
        if ($pstmtinsert->affected_rows > 0) {
            return true;
        }
        return false;
    }

}

?>
